<template>
  <a-tree class="tree_menu" blockNode :replace-fields="replaceFields" :tree-data="treeData" @select="onSelect" :selectedKeys='selectedKeys' show-icon>
    <IconFont type="swx-icon-zhankaiwenjianjiaiconkaobei2" slot="1" />
    <IconFont type="swx-icon-wenshu-wendang" slot="2" />
  </a-tree>
</template>

<script>
export default {
  props: {
    // 数据
    treeData: {
      type: Array,
      default() {
        return [];
      },
    },
    expandedKeys: {},
    // 默认选中
    selectedKeys: {
      type: Array,
      default() {
        return [];
      },
    },
    //
    replaceFields: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {
      // 选中节点
      selectedKey: [],
      autoExpandParent: true,
    };
  },
  mounted() {},
  methods: {
    onSelect(selectedKeys, info) {
      if (selectedKeys.length > 0) {
        this.selectedKey = selectedKeys;
        this.$emit("handClick", { selectedKeys, info });
      }
    },
    onExpand(expandedKeys) {
      this.expandedKeys = expandedKeys;
      this.autoExpandParent = false;
    },
  },
  computed: {},
};
</script>

<style>
</style>